You write custom CUDA kernels to replace the pytorch operators in the given architecture to get speedups.   
  
You have complete freedom to choose the set of operators you want to replace. You may make the decision to replace some operators with custom CUDA kernels and leave others unchanged. You may replace multiple operators with custom implementations, consider operator fusion opportunities (combining multiple operators into a single kernel, for example, combining matmul+relu), or algorithmic changes (such as online softmax). You are only limited by your imagination.  
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn

torch.backends.cuda.matmul.allow_tf32 = False

class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()
        self.out_size = [3, 3, 3]

    def forward(self, rois: torch.Tensor, pts: torch.Tensor, feats: torch.Tensor) -> torch.Tensor:
        M = rois.shape[0]
        N = pts.shape[0]
        C = feats.shape[1]
        
        out_x, out_y, out_z = self.out_size
        
        pts_exp = pts.unsqueeze(0)
        rois_exp = rois.unsqueeze(1)
        
        local_pts = pts_exp - rois_exp[..., :3]
        
        cos_a = torch.cos(-rois_exp[..., 6])
        sin_a = torch.sin(-rois_exp[..., 6])
        
        x_rot = local_pts[..., 0] * cos_a - local_pts[..., 1] * sin_a
        y_rot = local_pts[..., 0] * sin_a + local_pts[..., 1] * cos_a
        z_rot = local_pts[..., 2]
        
        dx = rois_exp[..., 3]
        dy = rois_exp[..., 4]
        dz = rois_exp[..., 5]
        
        in_flag = (x_rot > -dx/2) & (x_rot < dx/2) & \
                  (y_rot > -dy/2) & (y_rot < dy/2) & \
                  (z_rot > -dz/2) & (z_rot < dz/2)
        
        x_idx = ((x_rot + dx/2) / dx * out_x).long()
        y_idx = ((y_rot + dy/2) / dy * out_y).long()
        z_idx = ((z_rot + dz/2) / dz * out_z).long()
        
        valid = in_flag & \
                (x_idx >= 0) & (x_idx < out_x) & \
                (y_idx >= 0) & (y_idx < out_y) & \
                (z_idx >= 0) & (z_idx < out_z)
                
        output = torch.full((M, out_x, out_y, out_z, C), -1e38, dtype=feats.dtype, device=feats.device)
        
        # Slow python loop for correctness reference
        # Optimizing this in pure torch without scatter_reduce is hard for 5D tensor
        # Since this is just for verification, we iterate active rois
        
        valid_indices = torch.nonzero(valid) 
        
        if valid_indices.shape[0] > 0:
            m_idx = valid_indices[:, 0]
            n_idx = valid_indices[:, 1]
            
            vx = x_idx[m_idx, n_idx]
            vy = y_idx[m_idx, n_idx]
            vz = z_idx[m_idx, n_idx]
            
            val = feats[n_idx]
            
            flat_idx = m_idx * (out_x * out_y * out_z) + \
                       vx * (out_y * out_z) + \
                       vy * out_z + \
                       vz
            
            output_flat = output.view(-1, C)
            output_flat.index_reduce_(0, flat_idx, val, reduce='amax', include_self=True)
            output = output_flat.view(M, out_x, out_y, out_z, C)
            
        return output

M = 64
N = 16384
C = 1

def get_inputs():
    rois = torch.rand(M, 7, device='cuda', dtype=torch.float32)
    rois[:, :3] *= 100 
    rois[:, 3:6] = rois[:, 3:6] * 5 + 1 
    rois[:, 6] *= 3.14 
    
    pts = torch.rand(N, 3, device='cuda', dtype=torch.float32) * 120 - 10
    
    feats = torch.randn(N, C, device='cuda', dtype=torch.float32)
    
    return [rois, pts, feats]

def get_init_inputs():
    return []